import request from '@/utils/request'

// 查询
export function getPage(params) {
  return request({
    url: '/api/salarySettlement/getPage',
    method: 'get',
    params
  })
}
// 获取扣减列表
export function getDeductedList(id) {
  return request({
    url: '/api/salarySettlement/getDeductedList/' + id,
    method: 'get'
  })
}
// 获取绩效明细
export function getPerformance(data) {
  return request({
    url: '/api/salarySettlement/getPerformance',
    method: 'get',
    data
  })
}

// 获取单条工资结算（刷新用）
export function getById(id) {
  return request({
    url: '/api/salarySettlement/getById/' + id,
    method: 'get'
  })
}

// 计算绩效工资
export function calculatePerformance(id) {
  return request({
    url: '/api/salarySettlement/calculatePerformance/' + id,
    method: 'post'
  })
}

// 批量计算待发工资
export function calculateFinalSalary(data) {
  return request({
    url: '/api/salarySettlement/calculateFinalSalary',
    method: 'post',
    data
  })
}

// 新增或保存工资扣减
export function saveOrUpdateDeduction(data) {
  return request({
    url: '/api/salarySettlement/saveOrUpdateDeduction',
    method: 'post',
    data
  })
}
export default { getById, getPerformance, getPage, getDeductedList, calculatePerformance, calculateFinalSalary, saveOrUpdateDeduction }

